<?php
// 本类由系统自动生成，仅供测试用途
class GroupAction extends HomeAction {

     public function index(){
         
        $sdata=$_POST['searchdata'];
        $phone=$_POST['phone'];
        echo $sdata.$phone;
     }
     public function GetGroup() {
         
         $group=M('Coodt_group');
         $data['phone_num']=$_GET['phone'];
         $grouplist=$group->where($data)->select();
         if($grouplist!=null){ 
             $glist= json_encode($grouplist);;
             echo $glist;
         }else{
             echo "empty";
         }
         
     }
      public function CreateGroup() {
         
         $group=M('Coodt_group');
         $user=M('Coodt_user');
         $data['phone_num']=$_POST['phone'];
          //查询创建者信息
         $ulist=$user->where($data)->find();
         
        if($gdata=$group->create()){
            $gdata['uid']=$ulist['id'];
            $gdata['username']=$ulist['name']; 
            $Gdata['phone_num']=$_POST['phone'];
            
            if($gid=$group->add($gdata)){
                $gdata['id']=$gid;
                $glist= json_encode($gdata);;
                echo $glist;
            }else{
                echo "error";
            }
        } else{
            echo "error";
        }
         
         
     }
}